public class poly {
    public static void main(String[] args) {
        Animal animal=new Dog();
        animal.say();
        animal=new Pag();
        animal.say();
    }
}
class Animal{
    public void say(){
    }
}
class Dog extends Animal{
    int a=10;
public void say() {
    System.out.println("狗叫");
}
}
class Pag extends Animal{
    public void say(){
        System.out.println("猪叫");
    }
}
